package com.repast.service.impl;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.repast.common.Const;
import com.repast.common.ServerResponse;
import com.repast.dao.RewardStaffMapper;
import com.repast.pojo.RewardStaff;
import com.repast.service.IRewardStaffService;
import com.repast.utils.DateUtils;

@Service
public class IRewardStaffServiceImpl implements IRewardStaffService {

	@Autowired
	private RewardStaffMapper rewardMapper;
	public ServerResponse rewardEmployee(RewardStaff rewardStaff) {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
		String time = DateUtils.formatDateTime(new Date(), "long");
		rewardStaff.setRewardStaffCreateTime(time);
		rewardStaff.setRewardStaffUpdateTime(time);
		int insertReward = rewardMapper.insert(rewardStaff);
		if(insertReward==0){
			return ServerResponse.createByErrorCodeMessage(Const.REWARD_EMPLOYEE_FAIL, "系统异常,员工打赏失败");
		}
		return ServerResponse.createBySuccess();
	}

}
